﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace devtm.Editor.TypeSelector
{

    public class ObjectContainer : INotifyPropertyChanged
    {

        private Type _type;
        private Parameters _parameters;

        public ObjectContainer()
        {
            _parameters = new Parameters();
           
            _Valuesparameters.AddParameter();
        }


       


        public Type Type 
        {
            get { return _type; }
            set 
            {                
                _type = value;
                _parameters.Type = _type;
                MyPropertyChanged("Type");
                MyPropertyChanged("Parameters");

                _Valuesparameters.Clear();
                _Valuesparameters.AddParameter();

                foreach (ValueParameter item in _Valuesparameters)
                {
                    item.MyPropertyChanged("Parameters");
                }
            }

        }

        public Parameters Parameters { get { return _parameters; } }
        public ValuesParameters ValuesParameters { get { return _Valuesparameters; } }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void MyPropertyChanged(PropertyChangedEventArgs e)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, e);
        }
        protected void MyPropertyChanged(string propertyName)
        {
            MyPropertyChanged(new PropertyChangedEventArgs(propertyName));
        }


    }

}
